<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class MY_Form_validation extends CI_Form_validation {
    

    /**
     * Validate special characters
     *
     * @param $str
     */
    function special_characters($str) {
        if ($str != '' && !preg_match('/^([-a-z0-9\ _,.!?&\(\)\/])+$/i', $str)) {
            return false;
        }
        return true;
    }
    
    
    function exists($str, $field) {
        $field_ar = explode('.', $field);
        $query = $this->CI->db->get_where($field_ar[0], array($field_ar[1] => $str), 1, 0);
        if ($query->num_rows() === 0) {
            return FALSE;
        }
        return TRUE;
    }

}
?>